//
//  HMGradingAssignmentModel.m
//  优学荟管理系统
//
//  Created by 陈辉明 on 2017/12/26.
//  Copyright © 2017年 星道三好. All rights reserved.
//

#import "HMGradingAssignmentModel.h"

@implementation HMGradingAssignmentModel

- (instancetype)initWithDict : (NSDictionary*)dict{
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}
+ (instancetype)HMGradingAssignmentModelWithDict : (NSDictionary*)dict{
    return [[self alloc]initWithDict:dict];
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}

-(void)setValue:(id)value forKey:(NSString *)key {
    if ([key isEqualToString:@"arrangeHomeWorks"]) {
       
       self.Onemodel =  [HMGradingAssignmentOneModel HMGradingAssignmentOneModelWithDict:value];
       
    } else if ([key isEqualToString:@"arrangeHomeWorkAnswer"]) {
      
       self.twoModel =  [HMGradingAssignmentTwoModel HMGradingAssignmentTwoModelWithDict:value];
    } else {

        [super setValue:value forKey:key];
    }
}


@end

@implementation HMGradingAssignmentOneModel

- (instancetype)initWithDict : (NSDictionary*)dict{
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}
+ (instancetype)HMGradingAssignmentOneModelWithDict : (NSDictionary*)dict{
    return [[self alloc]initWithDict:dict];
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}

-(void)setValue:(id)value forKey:(NSString *)key {
    if ([key isEqualToString:@"paths"]) {
        self.paths = value;
        for (NSString *urlStr in value) {
            [self.oneDataArray addObject:urlStr];
        }
    } else if ([key isEqualToString:@"video"]) {
        self.video = value;
        if ([NSString isBlankString:self.video]) {
        }else {
            [self.oneDataArray addObject:value];
        }
    } else {
        [super setValue:value forKey:key];
    }
}


-(NSMutableArray *)oneDataArray {
    if (!_oneDataArray) {
        _oneDataArray = [NSMutableArray new];
    }
    return _oneDataArray;
}

@end

@implementation HMGradingAssignmentTwoModel

- (instancetype)initWithDict : (NSDictionary*)dict{
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}
+ (instancetype)HMGradingAssignmentTwoModelWithDict : (NSDictionary*)dict{
    return [[self alloc]initWithDict:dict];
}

-(void)setValue:(id)value forKey:(NSString *)key {
    if ([key isEqualToString:@"paths"]) {
        self.paths = value;
        for (NSString *urlStr in value) {
            [self.twoDataArray addObject:urlStr];
        }
        
    } else if ([key isEqualToString:@"answerVideo"]) {
        self.answerVideo = value;
        if ([NSString isBlankString:self.answerVideo]) {
        }else {
            [self.twoDataArray addObject:value];
        }
    } else {
        [super setValue:value forKey:key];
    }
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}

-(NSMutableArray *)twoDataArray {
    if (!_twoDataArray) {
        _twoDataArray = [NSMutableArray new];
    }
    return _twoDataArray;
}



@end

